#include "Cone.h"
#include <iostream>

using namespace std;

Symbol WCone::parse(ifstream &file, Symbol curToken) {
    float *numFill;
    
    curToken = matchToken(file, curToken, LBrace);
    numFill = parseVector(file, curToken, &curToken, 3);
    base = vec3(numFill[0], numFill[1], numFill[2]);
    delete numFill;

    curToken = matchToken(file, curToken, Comma);
    if (curToken.isToken) {
        cout << "Expected number, found " 
            << tokenList[curToken.t] << endl;
        exit(1);
    }
    baseR = curToken.num;

    curToken = nextToken(file);
    curToken = matchToken(file, curToken, Comma);
    numFill = parseVector(file, curToken, &curToken, 3);
    top = vec3(numFill[0], numFill[1], numFill[2]);
    delete numFill;

    curToken = matchToken(file, curToken, Comma);
    if (curToken.isToken) {
        cout << "Expected number, found " 
            << tokenList[curToken.t] << endl;
        exit(1);
    }
    topR = curToken.num;
    
    curToken = nextToken(file);
    curToken = parseMaterials(file, curToken, this);

    return curToken;
}

vec3 WCone::genRandomPoint(vec3 look, int cur, int lim) {
    return vec3(0.f, 0.f, 0.f);
}

bool WCone::intersect(Ray *r) {
    return false;
}

vec3 WCone::getNormal(Ray *r) {
    return vec3(0.0);
}
